﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows;
using MishraReader.Entities;
using MishraReader.Entities.ShareServices;

namespace MishraReader
{
    [DebuggerDisplay("Package = {ServiceName}")]
    class FacebookShareServicePackage : IShareServicePackage
    {
        private readonly IShareService _shareService;
        private readonly Func<IShareServiceConfigurationViewModel> _configViewModelFactory;
        private readonly IWpfApplication _application;

        public FacebookShareServicePackage(IShareService shareService,
            Func<IShareServiceConfigurationViewModel> configViewModelFactory, IWpfApplication application)
        {
            _shareService = shareService;
            _configViewModelFactory = configViewModelFactory;
            _application = application;

            var uri = string.Format("pack://application:,,,/MishraReader.ShareService.Facebook;component/FacebookIcon.png");

            ServiceLogoImageUri = new Uri(uri);
        }

        public void Initialize()
        {
            _application.AddApplicationResources(new Uri("pack://application:,,,/MishraReader.ShareService.Facebook;component/FacebookConfigurationViewModel.xaml"));
        }

        public string ServiceName
        {
            get { return _shareService.ServiceName; }
        }

        public Guid ServiceId
        {
            get { return _shareService.ServiceId; }
        }

        public IShareServiceConfigurationViewModel CreateConfigModel()
        {
            return _configViewModelFactory();
        }

        public IShareService Service
        {
            get { return _shareService; }
        }

        public Uri ServiceLogoImageUri { get; private set; }
    }
}
